using HCore.Unity.Core;
using UnityEngine;

namespace Test
{
    public class RightMenu : MonoBehaviour
    {
        private void Start()
        {
            Debug.Log("RightMenu Start");
        }

        private void Update()
        {
            if (Input.GetMouseButtonUp(1))
            {
                if (Physics.Raycast(GameUtils.MainCamera.ScreenPointToRay(Input.mousePosition), out var hit0))
                {
                    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit0.distance, Color.yellow);

                    Debug.Log(hit0.collider.gameObject.name);
                }

                if (Physics.Raycast(Input.mousePosition, Vector3.forward, out var hit1))
                {
                    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit1.distance, Color.yellow);

                    Debug.Log(hit1.collider.gameObject.name);
                }

                if (Physics.Raycast(Input.mousePosition, Vector3.back, out var hit2))
                {
                    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit2.distance, Color.yellow);

                    Debug.Log(hit2.collider.gameObject.name);
                }

                Debug.Log("1");
            }
        }
    }
}